"""
写一个base62encode函数，计算62进制
即：0123456789ABCDE..Zabcde...z(10个数字，26个大写字母，26个小写字母)

base62encode(1)  = 1
base62encode(64) = z
base62encode(62) = 10
"""


def base62encode(n):
    lst = []
    s = "0123456789ABCDEFGHIJKLMNOPQRSZUVWSYZabcdefghijklmnopqrszuvwsyz"
    while n > 0:
        y = n % 62
        print("余数：",y)
        lst.append(s[y])
        n = n // 62
    print(lst)
    return "".join(lst[::-1])  # 到着取


print(base62encode(190))
print(base62encode(61))
print(base62encode(62))
print(base62encode(60))


def base16encode(n):
    lst = []
    s = "0123456789ABCDEF"
    while n > 0:
        y = n % 16
        lst.append(s[y])
        n = n // 16
    return "".join(lst[::-1])


print(base16encode(1))
print(base16encode(61))
print(base16encode(62))
print(base16encode(60))